package com.yxw.live_vod_backend_boot.controller;



import com.yxw.yxnet_cd_center.common.utils.BaseResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import com.yxw.live_vod_backend_boot.util.PageUtils;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.Api;
import com.yxw.live_vod_backend_boot.dto.YxLiveAgreementDTO;
import com.yxw.live_vod_backend_boot.dto.YxLiveAgreementAddDTO;
import com.yxw.live_vod_backend_boot.dto.YxLiveAgreementQueryDTO;
import com.yxw.live_vod_backend_boot.entity.YxLiveAgreementEntity;
import com.yxw.live_vod_backend_boot.service.IYxLiveAgreementService;
 
 
 
/*** 
*@author Jiaxu.Huang
*@date 2023/12/10 11:46:16
*@update 2023/12/10 11:46:16
**/
@Api(value = "直播开播协议", tags = {"直播开播协议管理"},description="直播开播协议管理")
@RestController
@RequestMapping("/api/backend/yxliveagreement")
public class YxLiveAgreementController
{
    @Resource
    private IYxLiveAgreementService oYxLiveAgreementService;
    /*** 
    * 增加直播开播协议
    * @param oYxLiveAgreementDTO
    * @return BaseResult
    **/
    @ApiOperation(value ="新增直播开播协议(YxLiveAgreement)", notes = "此接口用于新增直播开播协议")
    @ApiResponses({@ApiResponse(code = 200,message = "OK",response = YxLiveAgreementEntity.class),})
    @PostMapping("/addYxLiveAgreement")
    public BaseResult addYxLiveAgreement(@RequestBody @Valid YxLiveAgreementAddDTO oYxLiveAgreementAddDTO)
    {
        return oYxLiveAgreementService.insertYxLiveAgreement(oYxLiveAgreementAddDTO);
    }
    /*** 
    * 修改直播开播协议
    * @param oYxLiveAgreementDTO
    * @return BaseResult
    **/
    @ApiOperation(value ="修改直播开播协议(YxLiveAgreement)",notes = "此接口用于修改直播开播协议信息")
    @ApiResponses({@ApiResponse(code = 200,message = "OK",response = BaseResult.class),})
    @PostMapping("/editYxLiveAgreement")
    public BaseResult editYxLiveAgreement(@RequestBody @Valid YxLiveAgreementDTO oYxLiveAgreementDTO)
    {
        return oYxLiveAgreementService.updateYxLiveAgreementById(oYxLiveAgreementDTO);
    }
    /*** 
    * 删除直播开播协议
    * @param id
    * @param oYxLiveAgreementDTO
    * @return BaseResult
    **/
    @ApiOperation(value ="删除直播开播协议YxLiveAgreement",notes = "此接口用于删除直播开播协议信息")
    @ApiResponses({@ApiResponse(code = 200,message = "OK",response = BaseResult.class),})
    @GetMapping("/removeYxLiveAgreement/{id}")
    public BaseResult removeYxLiveAgreement(@PathVariable @NotNull(message = "id不能为空")Integer id)
    {
            return oYxLiveAgreementService.deleteYxLiveAgreementById(id);
    }
    /*** 
    * 根据id查找直播开播协议
    * @param id
    * @param oYxLiveAgreementDTO
    * @return YxLiveAgreementEntity
    **/
    @ApiOperation(value ="根据id查找直播开播协议",notes = "此接口用于根据id查找直播开播协议信息")
    @ApiResponses({@ApiResponse(code = 200,message = "OK",response = YxLiveAgreementEntity.class),})
    @GetMapping("/getYxLiveAgreementInfo/{id}")
    public BaseResult getYxLiveAgreementInfo(@PathVariable @NotNull(message = "id不能为空")Integer id,@RequestBody @Valid YxLiveAgreementDTO oYxLiveAgreementDTO)
    {
        return BaseResult.success(oYxLiveAgreementService.selectYxLiveAgreementById(id));
    }
    /*** 
    * 自定义分页查询直播开播协议
    * @param currentPage 当前页
    * @param pageSize 分页大小
    * @param oYxLiveAgreementDTO
    * @return Page
    **/
    @ApiOperation(value ="自定义分页查询直播开播协议",notes = "此接口用于自定义分页查询直播开播协议信息")
    @ApiResponses({@ApiResponse(code = 200,message = "OK",response = YxLiveAgreementEntity.class),})
    @PostMapping("/selectYxLiveAgreementPage/{currentPage}/{pageSize}")
    public BaseResult selectYxLiveAgreementPage(@PathVariable int currentPage,@PathVariable int pageSize,@RequestBody YxLiveAgreementQueryDTO oYxLiveAgreementQueryDTO)
    {
        return BaseResult.success(PageUtils.get(oYxLiveAgreementService.selectYxLiveAgreementPage(currentPage,pageSize,oYxLiveAgreementQueryDTO)));
    }
    /*** 
    * 自定义不分页查询直播开播协议
    * @param oYxLiveAgreementDTO
    * @return List<YxLiveAgreementEntity>
    **/
    @ApiOperation(value ="自定义不分页查询直播开播协议",notes = "此接口用于自定义不分页查询直播开播协议信息")
    @ApiResponses({@ApiResponse(code = 200,message = "OK",response = YxLiveAgreementEntity.class),})
    @PostMapping("/selectYxLiveAgreementList")
    public BaseResult selectYxLiveAgreementList(@RequestBody YxLiveAgreementQueryDTO oYxLiveAgreementQueryDTO)
    {
        return BaseResult.success(oYxLiveAgreementService.selectYxLiveAgreementList(oYxLiveAgreementQueryDTO));
    }
    /*** 
    * 自定义统计直播开播协议
    * @param oYxLiveAgreementDTO
    * @return int
    **/
    @ApiOperation(value ="自定义统计直播开播协议",notes ="此接口用于自定义统计直播开播协议记录条数")
    @PostMapping("/selectYxLiveAgreementCount")
    public BaseResult selectYxLiveAgreementCount(@RequestBody YxLiveAgreementQueryDTO oYxLiveAgreementQueryDTO)
    {
        return BaseResult.success(oYxLiveAgreementService.selectYxLiveAgreementCount(oYxLiveAgreementQueryDTO));
    }
    /*** 
    * 获取正在生效的主播协议
    * @return List<YxLiveAgreementEntity>
    **/
    @ApiOperation(value ="获取正在生效的主播协议",notes ="此接口用于获取正在生效的主播协议")
    @GetMapping("selectActiveAgreement")    
    public BaseResult selectActiveAgreement()
    {
        return oYxLiveAgreementService.selectActiveAgreement();
    }
}
    

